<%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@page import="utility.connections"%>

<%  
		
			if (session.getAttribute("user")==null)
			response.sendRedirect("loginerr.jsp");
			
			else
			{
	
			String user = session.getAttribute("user").toString();
			String type = session.getAttribute("type").toString();
			String matr = session.getAttribute("matricola").toString();
			String nome = session.getAttribute("nome").toString();
			String cogn = session.getAttribute("cognome").toString();
			}
%>
<script type="text/javascript">
	function insert(formName)
	{
		
		var pattern= /[A-Z a-z]/;
		var	codice=document.forms[formName].elements["codice"].value;
		var denominazione=document.forms[formName].elements["denominazione"].value;

		if(denominazione.length==0)
		{
			alert("ERROR lunghezza campo Denominazione errata");
			return;
		}
		if(codice.length!=0 && !pattern.test(codice))
		{	
			alert("ERROR forma campo codice errata");
			return;
		}
		document.forms[formName].submit();	
	}
	function back()
	{
		document.frmin.action="../hadm.jsp";
		document.frmin.submit();
	}
</script>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>nuvo dipendente</title>
<link href="../../layout.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="js/immagini.js"></script>
</head>

<body>
<%
	if(request.getParameter("insert")!=null)
		out.println("<script type=\"text/javascript\"> alert(\"Gruppo di Lavoro creato.\"); </script>");
%>
<table width="700" height="422" border="0" align="center">
  
  <tr>
    <td height="257" align="center" valign="top"><table width="100%" border="0">
      <tr>
        <td colspan="4" align="center"><div align="left">
          <p class="style3">		  </p>
        </div></td>
        </tr>
      <tr>
        <td colspan="4" class="style2"><p align="center"><strong>Inserisci i dati del gruppo di lavoro  </strong></p></td>
        </tr>
        <td align="left">

	  <form name="frmin" method="post" action="../../Insert_gdl">
	  </td>
	  <tr>
        <td class="style1">&nbsp;</td>
        <td class="style2"><div align="right">codice:</div></td>
        <td class="style2"><input type="text" name="codice" value="" disabled="disabled" readonly="readonly"/></td>
        <td class="style3">&nbsp;</td>
      </tr>
      <tr>
        <td class="style2">&nbsp;</td>
        <td class="style2"><div align="right">denominazione </div></td>
        <td class="style2"><input type="text" name="denominazione" value="" /></td>
        <td class="style2">&nbsp;</td>
      </tr>
      <tr>
        <td class="style2">&nbsp;</td>
        <td class="style2">&nbsp;</td>
        <td class="style2">
		<input type="button" value="INSERISCI" onclick="javascript:insert('frmin');"/>
		<input type="button" value="INDIETRO" onclick="javascript:back();"/>
	</tr>
	</form>  
	
					      
    </table></td>
  </tr>
  <tr>
    <td align="center" valign="middle">
    <%
    	String qry = "select count(*) as totale from gruppodilavoro";
    	ResultSet rs = connections.getStatement().executeQuery(qry);
    	rs.next();
    	out.println("TOTALE RECORD: " + rs.getString("totale"));
    	
    	rs.close();
    %>
    </td>
  </tr>
</table>
</body>
</html>
